Skip to content

wd_rtsp.sh: make the locked rRTSPServer check work - #482

Merged
alienatedsec merged 1 commit into
alienatedsec:masterfrom
grzesiczek1:fix/wd-rtsp-lock-check
Nov 11, 2026
Merged

alienatedsec merged 1 commit into
alienatedsec:masterfrom
grzesiczek1:fix/wd-rtsp-lock-check

Conversation

@grzesiczek1

Copy link
Copy Markdown
Contributor

check_rtsp() greps netstat for ":$RTSP_PORT ", but the script only sets RRTSP_PORT. With the empty variable the pattern is ": ", which matches no line, so SOCKET is always 0 and the "possible locked process" branch never runs: a hung rRTSPServer is never restarted.

This uses RRTSP_PORT and counts ESTABLISHED connections instead of LISTEN, as wd.sh in yi-hack-Allwinner-v2 does. The check is meant for "clients are connected but the server uses no CPU"; counting LISTEN would also apply it to an idle server with no clients.

Tested on a Yi Outdoor 1080p (Hi3518E, 0.4.1, RTSP_STREAM=both) with two RTSP clients, using a copy of the script whose actions only log:

  • before the change, SOCKET is 0 on every loop;
  • after kill -STOP on rRTSPServer it logs "Detected possible locked process (1)" … "(10)" within ~16 s, then "Restarting rtsp process";
  • during ~28 min of normal streaming afterwards the counter reached (1) twice, from a single 0.0 % sample of top -b -n 1, and reset on the next loop. It never came close to the limit of 10.

🤖 Generated with Claude Code

check_rtsp() counts sockets with grep ":$RTSP_PORT ", but the script
only sets RRTSP_PORT. With the empty variable the pattern is ": ",
which matches no netstat line, so SOCKET is always 0 and the "possible
locked process" check never runs: a hung rRTSPServer is not restarted.

Use RRTSP_PORT and count ESTABLISHED connections instead of LISTEN, as
wd.sh in yi-hack-Allwinner-v2 does. The check is meant for "clients are
connected but the server uses no CPU"; with LISTEN it would also count
an idle server that has no clients.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@alienatedsec alienatedsec added the enhancement New feature, improvement, or request label Nov 2, 2026
@alienatedsec
alienatedsec merged commit c73da1f into alienatedsec:master Nov 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature, improvement, or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants